var ajax = require('../../utils/ajax.js');
var common = require('../../utils/common.js');
var app = getApp();

Page({
	data: {
		dataLoaded: false,
	},

	onLoad(options) {
		this.techId = options.techId;

		this.setData({
			dataLoaded: true,
			winHei: app.getWinHei(),
		});
	},

	_submit(e) {
		var _self = this;
		var formData = e.detail.value || {};

		formData['technician_id'] = _self.techId;

		ajax.P('/openapi/CTechnician/claimTechnician', formData, function(res) {
			app.globalData.techId = _self.techId;
			wx.redirectTo({
				url: '/pages/appointOrderList/appointOrderList?ty=0'
			});
		});
		common.submitForm(e.detail.formId);
	},
});